<script setup lang="ts">
// 在 Vue3 CompositionAPI 中
// 1. 获取路由对象 router  useRouter
//    const router = useRouter()
// 2. 获取路由参数 route   useRoute
//    const route = useRoute()
import { useRoute, useRouter } from 'vue-router'

// import { useUserStore, useCountStore } from '@/stores'
const router = useRouter()
const route = useRoute()

const goList = () => {
  router.push('/list')
  console.log(router, route)
}
// import { storeToRefs } from 'pinia'
// import { useUserStore } from '@/store/user.js'
import { useUserStore } from '@/store'
const userStore = useUserStore()
// console.log(userStore.setToken('666'))

// const { token, setToken, removeToken } = storeToRefs(userStore)
</script>

<template>
  <div>
    <hr />
    <hr />
    <hr />

    我是App
    <!-- 导入element ui 之后组件可以直接用 不用自己去导入  -->
    <test-demo></test-demo>
    <el-button @click="$router.push('/home')">跳首页</el-button>
    <el-button @click="goList">跳列表页</el-button>

    <el-button type="primary">Primary</el-button>
    <el-button type="success">Success</el-button>
    <p>{{ userStore.token }}</p>
    <el-button @click="userStore.setToken('我是token')">登录</el-button>
    <el-button @click="userStore.removeToken">退出</el-button>
  </div>
</template>

<style scoped></style>
